﻿using System;
using FlatRedBall;
using FlatRedBall.Utilities;
using Microsoft.Xna.Framework;

namespace Rvz.Game.Main
{
    public abstract class RvzGameBase : Microsoft.Xna.Framework.Game
    {
        protected readonly GraphicsDeviceManager Graphics;
        protected BackStack<string> BackStack;
        private const string ContentPath = "Content\\";
        private const string EffectsPathPrefix = ContentPath + "Effects\\";
        private const string RobotsPathPrefix = ContentPath + "Robots\\";
        private const string TerrainPathPrefix = ContentPath + "Terrain\\";
        private const string ZombiesPathPrefix = ContentPath + "Zombies\\";

        protected RvzGameBase()
        {
            Graphics = new GraphicsDeviceManager(this) { PreferredBackBufferHeight = 600 };
            Content.RootDirectory = "Content";

            BackStack = new BackStack<string> { Current = string.Empty };
        }

        protected virtual Sprite AddSprite(SpriteType spriteType, string spriteName)
        {
            string prefix = string.Empty;
            switch (spriteType)
            {
                case SpriteType.Effect:
                    prefix = EffectsPathPrefix;
                    break;
                case SpriteType.Robot:
                    prefix = RobotsPathPrefix;
                    break;
                case SpriteType.Terrain:
                    prefix = TerrainPathPrefix;
                    break;
                case SpriteType.Zombie:
                    prefix = ZombiesPathPrefix;
                    break;
                default:
                    break;
            }

            return SpriteManager.AddSprite(prefix + spriteName);
        }

        public enum SpriteType
        {
            Effect,
            Robot,
            Terrain,
            Zombie,
        }
    }
}
